<template>
    <div>
        <ul class="mui-table-view">
            <li class="mui-table-view-cell mui-media" v-for="item in newList" :key="item.id">
                <router-link :to="'/home/newsInfo/'+item.id">
                    <p class="mui-media-object mui-pull-left" style="width:42px; height:42px; background-color:red;"></p>
                    <div class="mui-media-body">
                        {{item.title}}
                        <p class='mui-ellipsis'>
                            <span>发表时间:{{item.add_time}}</span>
                            <span>点击次数:{{item.click}}次</span>
                        </p>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    data(){
        return {
            newList:[]
        }
    },
    created(){
        this.getNewsList()
    },
    methods:{
        getNewsList(){
            this.$http.get('/json/json_news.txt').then(result=>{
                var newsData=JSON.parse(result.bodyText)
                if(newsData.status==0)
                {
                    this.newList=newsData.message
                }

            },function(){
                console.log("失败了")
            })
        }
    }
}
</script>

<style>
.mui-ellipsis{justify-content:space-between; display: flex}
</style>